<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="com.ubst.smartad.logger.Debug" %>
<%@page import="net.sf.json.JSONArray"  %>
<%@page import="net.sf.json.JSONObject"  %>
<%@page import="java.util.HashMap" %>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
<%@page import="java.io.PrintWriter" %>
<%@page import="com.ubst.smartad.dbpool.TransactionManager" %>
<%@page import="com.ubst.smartad.tree.TreeMngImpl" %>
<%@include file="/jsp/inc/base.jsp"%>
<jsp:useBean id="tem" class="com.ubst.smartad.template.Template" scope="page"/>
<% 
	String id = "";
	if( request.getParameter("treeType") == null ) {
		id = "system";
	} else {
		id = request.getParameter("treeType");
	}
	tem.setFileText( web_root+"skin1/tree/tree_"+id+".html");
	/*
	tem.setFileText( web_root+"skin1/admin/status/manage.html");
	String searchStr = null;
	int searchType = 0;
	TreeMngImpl treeMng = null;
	TransactionManager tm = null;
	try{
		
		// setting
		if( request.getParameter("searchStr") != null ) {
			searchStr = request.getParameter("searchStr");
		}
		if( request.getParameter("searchType") != null ) {
			searchType = Integer.parseInt(request.getParameter("searchType"));
		}
	
		tm = new TransactionManager();
		treeMng = new TreeMngImpl(tm.connection, serverName, fhostEnv.getLogLevel());
		List<HashMap<String,String>> list = treeMng.getSystemTree(searchStr, searchType);
		int listSize = list.size();
		
		for( int ii=0; ii<listSize; ii++ ) {
			HashMap<String,String> listData = (HashMap<String,String>)list.get(ii);
		}
		
		JSONArray jsonArr = JSONArray.fromObject(list);
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("tree", jsonArr);		// Data
		
		response.setContentType("text/plain; charset=utf-8"); 
		response.setHeader("Cache-Control", "no-cache"); 
		//PrintWriter out = response.getWriter();
		out.print(jsonObj.toString());
		System.out.println("jsonObj.toString() "+jsonObj.toString());
		out.flush();
	}catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if( tm != null ) { tm.freeConnection(); }
		} catch ( Exception e ) {}
	}
	*/
%>
<%@include file="/jsp/inc/out.jsp"%>
				